<template>
  <div>
    用户名:
    <input v-model="username" type="text">
  </div>
</template>

<script>
export default {
  name: 'CodeApp',

  data() {
    return {
      username:''
    };
  },
  watch:{
    // watch语法：
    // 函数名就是侦听属性名
    username(newVal,oldVal){
      console.log(newVal,oldVal);
    }
  },
  mounted() {
    
  },

  methods: {
    
  },
};
</script>

<style lang="scss" scoped>

</style>